import axios from 'axios'

const request =axios.create({});
// 添加请求拦截器
request.interceptors.request.use(
	(config) => {
		console.log("请求拦截器");
        const token= localStorage.getItem('token');
        if(token){
            config.headers.Authorization = `Bearer ${token}`;
        }
		return config;
	},
	(error) => {
		return Promise.reject(error);
	}
)
//响应拦截器
request.interceptors.response.use(
	(response) => {
		console.log("响应拦截器");
		return response.data;
	}
)
export default request;